# SlideScript makefile
# (C) Copyright 2014-2022 Chris Dorman, some rights reserved (GPLv2)
# Some changes and tweaks from Menchers

VERSION       = \"0.7.2\"
VERSION_EXTRA = \"$(EXTRA)\"

PREFIX ?= /usr

#CC           ?= musl-gcc
#CC           ?= gcc
#CC           ?= tcc
CC           ?= musl-tcc
CFLAGS       += -O2 -pedantic -g -Wall -Wextra
CPPFLAGS     += -DVERSION=$(VERSION) -D_FORTIFY_SOURCE=2
LDFLAGS      += -lc -L/planck/lib/tcc -L/planck/lib -ltcc1 -dynamic-linker /planck/lib/libc.so /planck/lib/crti.o /planck/lib/crt1.o /planck/lib/crtn.o -nostdlib
BIN          ?= slidescript

SRCS=$(wildcard src/*.c) $(wildcard src/lz78/*.c)

OBJECTS=$(SRCS:%.c=%.o)

all: main

fresh: clean all

.c.o:
	$(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@

main: $(OBJECTS)
	$(CC) $(OBJECTS) -o $(BIN) $(LDFLAGS) $(CFLAGS)
	
clean:
	rm -f $(OBJECTS) $(BIN)
	
install:
	install -D $(BIN) $(DESTDIR)/$(PREFIX)/bin/$(BIN)
